const clu = require('cluster');
const os = require('os');
const process = require('process');
if (clu.isMaster) {
    for (var i = 0; i< os.cpus().length; i++) {
        clu.fork();
    }
} else {
    // clu.worker.forEach(function(item, index) {
    //     console.log(item[id])
    // })
    let num = clu.worker.id;
    if (num === 1) {
        console.log(11111)
    } else  if (num === 2) {
        console.log(2222)
    }
    console.log(process.pid)
    // for(let prop in clu.worker) {
    //     console.log(clu.worker[prop])
    // }
}

